package file;

import org.junit.Test;

import java.io.File;

/**
 * Created by csmd on 2017/12/27.
 */
public class test {
    @Test
    public void test(){
        //String posUrl = imgFileUrlPos + File.separator;
        String posUrl = "D:/zipFile/"+File.separator;
        File file=new File(posUrl+"33333.zip");
        if(file.exists()&&file.isFile()){
            System.out.println("存在文件");
        }else{
            System.out.println("不存在文件");

        }
    }
    public static void main(String[] args){
        float f =(float)3.4;
        float ff =3.4F;
        float fff = Float.valueOf(String.valueOf(3.4));
        System.out.println(f);
        short s1 = 1;
        //s1 = s1 + 1;
        short s2= 1;
        s2 += 1;
        int a =3;
        Integer a0 =3;
        Integer a1 =3;
        Integer a2 = new Integer(3);
        Integer a3 = new Integer(3);
        System.out.print(a0==a1);
        System.out.print(a==a1);
        System.out.print(a==a2);
        System.out.print(a3 ==a2);
        System.out.println("aaa".length());
        int s[] ={123,2};
        System.out.println(s.length);
        for(int i=0;i < 5;i++){
            if(i  == 2){
                //continue;
                return;
            }
            System.out.println("----"+i);
        }

    }
    @Test
    public void test2(){
        String s1 = "Programming";
         String s2 = new String("Programming");
         String s3 = "Program" + "ming";
        System.out.println(s1 == s2);// false
        System.out.println(s1 == s3);//true
        System.out.println(s1 == s1.intern());//true
        //39、如何实现字符串的反转及替换？
        String ss = "123456";
        StringBuffer sss = new StringBuffer(ss);
        System.out.println(sss.reverse());//true
        //递归实现字符串反转
        System.out.println("ddddddddd"+test.reverse(ss));//true

    }
    public static String reverse(String originStr) {
        if(originStr == null || originStr.length() <= 1)
                return originStr;
        System.out.println(originStr.substring(1));
        System.out.println(originStr.charAt(0));//用于返回指定索引处的字符。索引范围为从 0 到 length() - 1。
        System.out.println(originStr.charAt(0));

       // return reverse(originStr.substring(1)) + originStr.charAt(0);
        return reverse(originStr.substring(1)) + originStr.substring(0,1);
    }
    @Test
    public void tersr(){
        System.out.println("123456".substring(1,2));
        System.out.println("123456".substring(2,5));//2<=下标<5   345
        System.out.println("123456".substring(0,1));//2<=下标<5   345

        System.out.println("123456".substring(1));//1<=下标
        System.out.println("------------------");//1<=下标
        System.out.println("123456".charAt(0));//1<=下标

    }
}

